//package com.stu.vertx.hello.config;
//
//import org.slf4j.MDC;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerInterceptor;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.UUID;
//
//@Component
//public class TraceIdInterceptor implements HandlerInterceptor {
//
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
//        MDC.put("trace_id", UUID.randomUUID().toString().replaceAll("-", ""));
//        MDC.put("span_id", UUID.randomUUID().toString().replaceAll("-", "").substring(0, 16));
//        return true;
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//        MDC.clear();
//    }
//}